home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / boot / sunprom / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-11-27  |  2.6 KB  |  117 lines

  1. /* 
  2.  * main.c --
  3.  *
  4.  *    The main program for booting.
  5.  *
  6.  * Copyright 1986 Regents of the University of California
  7.  * All rights reserved.
  8.  */
  9.  
  10. #ifdef  notdef
  11. static char rcsid[] = "$Header: /sprite/src/boot/sunprom/RCS/main.c,v 1.9 90/11/27 11:17:24 jhh Exp $ SPRITE (Berkeley)";
  12. #endif not lint
  13.  
  14.  
  15. #include "sprite.h"
  16. #include "machMon.h"
  17. #include "fsBoot.h"
  18. #include "boot.h"
  19. #undef NO_PRINTF
  20.  
  21. extern Fs_Device fsDevice;        /* Global FS device descriptor */
  22.  
  23. void Exit();
  24.  
  25. /*
  26.  *----------------------------------------------------------------------
  27.  *
  28.  * main --
  29.  *
  30.  *      This gets arguments from the PROM, calls other routines to open
  31.  *      and load the program to boot, and then transfers execution to that
  32.  *      new program.
  33.  *
  34.  * Results:
  35.  *    None.
  36.  *
  37.  * Side effects:
  38.  *    None.
  39.  *
  40.  *----------------------------------------------------------------------
  41.  */
  42.  
  43. main()
  44. {
  45.     ReturnStatus status;
  46.     register MachMonBootParam *paramPtr;/* Ref to boot params supplied
  47.                      * by the PROM montor */
  48.     register int index;            /* Loop index */
  49.     register int entry;            /* Entry point of boot program */
  50.     Fsio_FileIOHandle *handlePtr;    /* Handle for boot program file */
  51.     char *fileName = "vmsprite";
  52.  
  53.     /*
  54.      * The Sun prom collects the boot command line arguments and
  55.      * puts makes them available throught the rom vector.
  56.      */
  57.     paramPtr = *romVectorPtr->bootParam;
  58. #ifdef notdef
  59.     for (index=0 ; index < 8; index ++) {
  60.     if (paramPtr->argPtr[index] != (char *)0) {
  61.         Mach_MonPrintf("Arg %d: %s\n", index, paramPtr->argPtr[index]);
  62.     } else {
  63.         break;
  64.     }
  65.     }
  66.     Mach_MonPrintf("Device %s\n", paramPtr->devName);
  67.     Mach_MonPrintf("File \"%s\"\n", paramPtr->fileName);
  68.  
  69.  
  70. #endif
  71.     /*
  72.      * Set up state about the boot device.
  73.      */
  74.     dev_config(paramPtr, &fsDevice);
  75.     if (paramPtr->fileName[0]) {
  76.     fileName = paramPtr->fileName;
  77.     }
  78.     /*
  79.      * Set up state about the disk.
  80.      */
  81.     status = FsAttachDisk(&fsDevice);
  82. #ifndef SCSI3_BOOT
  83.     if (status != SUCCESS) {
  84.     Mach_MonPrintf("Can't attach disk, status <0x%x>\n",  status);
  85.     goto exit;
  86.     }
  87.     Mach_MonPrintf("Open File \"%s\"\n", fileName);
  88. #endif
  89.     /*
  90.      * Open the file to bootstrap.
  91.      */
  92.     status = Open(fileName, FS_READ, 0, &handlePtr);
  93.     if (status != SUCCESS) {
  94.     Mach_MonPrintf("Can't open \"%s\", <%x>\n", fileName, status);
  95.     goto exit;
  96.     }
  97.     entry = FileLoad(handlePtr);
  98.     if (entry != -1) {
  99.     Mach_MonPrintf("Transferring to location 0x%x\n", entry);
  100.     Boot_Transfer(entry);
  101.     }
  102. exit:
  103.     return;
  104. }
  105.  
  106. /*
  107.  * Exit is called by start.s
  108.  */
  109. void
  110. Exit()
  111. {
  112.     /*
  113.      * Return to start.s and then the PROM monitor.
  114.      */
  115.     return;
  116. }
  117.